package first.group.ssh.packet;

import first.group.ssh.SSHConsts;
import first.group.ssh.packet.reader.StringReader;

import java.nio.ByteBuffer;

public class UnimplementedPacket extends Packet{
    public final int seq;

    public UnimplementedPacket(int seq) {
        super(SSHConsts.SSH_MSG_UNIMPLEMENTED);
        this.seq = seq;
    }
    public static PacketParser<UnimplementedPacket> PARSER = new UnimplementedPacket.Parser();

    private static class Parser extends PacketParser<UnimplementedPacket> {

        @Override
        public UnimplementedPacket parse(ByteBuffer buffer) {
            if (!bufferRemains(buffer, 4)) {
                return null;
            }
            var seq = buffer.getInt();
            return new UnimplementedPacket(seq);
        }
    }
    @Override
    public void write(ByteBuffer buffer) {
        buffer.putInt(seq);
    }
}
